package main

import "fmt"

type Student struct {
	name string
}

func (this Student) setName(name string) {
	this.name = name
}

func (this *Student) setName2(name string) {
	this.name = name
}

func main() {
	stu := Student{"Mr"}
	// 值传递 结构体也是copy，不会影响原结构体的值
	stu.setName("Mr2")
	fmt.Println(stu)

	// 引用传递会影响原结构体的值
	stu.setName2("Mr3")
	fmt.Println(stu)
}
